package com.xingkeduo.model.vo;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.xingkeduo.model.po.TStaffAttendance;

import java.text.DateFormat;
import java.text.SimpleDateFormat;

/**
 * @Description TODO
 * @Date 2019/4/12 15:44
 * @Created 情绪十分不稳定的Shadow
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
public class StartAttendanceVo {

    private String headUrl;
    private Integer id;
    private String staffName;
    private String craftsName;
    @JsonSerialize(using = ToStringSerializer.class)
    private Long staffId;
    private String date;
    private String startTime;
    private String realWorkStartTime;

    public StartAttendanceVo(TStaffAttendance tStaffAttendance, String headUrl, String craftsName) {
        SimpleDateFormat simdf = new SimpleDateFormat("yyyy-MM-dd");
        SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm:ss");
        this.headUrl = headUrl;
        this.craftsName = craftsName;
        this.id = tStaffAttendance.getId();
        this.staffName = tStaffAttendance.getStaffName();
        this.staffId = tStaffAttendance.getStaffId();
        this.date = simdf.format(tStaffAttendance.getDate());
        if(tStaffAttendance.getStartTime() != null){
            this.startTime = timeFormat.format(tStaffAttendance.getStartTime());
        }
        if(tStaffAttendance.getRealWorkStartTime() != null){
            this.realWorkStartTime = timeFormat.format(tStaffAttendance.getRealWorkStartTime());
        }
    }

    public String getHeadUrl() {
        return headUrl;
    }

    public void setHeadUrl(String headUrl) {
        this.headUrl = headUrl;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getStaffName() {
        return staffName;
    }

    public void setStaffName(String staffName) {
        this.staffName = staffName;
    }

    public Long getStaffId() {
        return staffId;
    }

    public void setStaffId(Long staffId) {
        this.staffId = staffId;
    }

    public String getDate() {
        return date;
    }

    public void setDate(String date) {
        this.date = date;
    }

    public String getStartTime() {
        return startTime;
    }

    public void setStartTime(String startTime) {
        this.startTime = startTime;
    }

    public String getRealWorkStartTime() {
        return realWorkStartTime;
    }

    public void setRealWorkStartTime(String realWorkStartTime) {
        this.realWorkStartTime = realWorkStartTime;
    }

    public String getCraftsName() {
        return craftsName;
    }

    public void setCraftsName(String craftsName) {
        this.craftsName = craftsName;
    }
}
